package com.itheima.homework2;

import java.util.concurrent.*;

public class Demo2_AutoamticThreadPool {
    public static void main(String[] args) {
        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                2,
                5,
                10,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()
        );
        for (int i = 0; i < 15; i++) {
            pool.submit(()-> System.out.println(Thread.currentThread().getName()+"开始了"));
        }


    }
}
